package com.heu.blood.transfusion.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.heu.blood.common.utils.PageUtils;
import com.heu.blood.statistic.entity.ApplyData;
import com.heu.blood.statistic.entity.DepartmentUseNum;
import com.heu.blood.transfusion.entity.TransfusionApplicationEntity;
import com.heu.blood.transfusion.vo.ABOTypeVo;
import com.heu.blood.transfusion.vo.TransfusionApplicationAnalysisVo;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author myq
 * @since 2023-07-01
 */
public interface TransfusionApplicationService extends IService<TransfusionApplicationEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 查询输血申请单信息
     * @param transfusionApplicationEntity
     * @return
     */
    List<TransfusionApplicationEntity> query(TransfusionApplicationEntity transfusionApplicationEntity);

    /**
     * 根据输血申请单号查询输血申请单信息
     * @param transfusionId
     * @return
     */
    TransfusionApplicationEntity queryByTransfusionId(String transfusionId);
    /**
     * 多字段查询
     */
    List<TransfusionApplicationEntity> selectKeyword(String searchType,String beginTime,String endTime);

    /**
     * 获取当日的输血申请数
     */
    Integer getApplyNum();

    /**
     * 获得指定日期的输血申请数
     * @param curDate
     * @return
     */
    Integer getApplyNum(LocalDate curDate);

    /**
     * 获得指定日期指定科室的输血申请数
     * @param curDate
     * @param code
     * @return
     */
    Integer getApplyNum(LocalDate curDate, String code);

    /**
     * 获取七日用血申请单数
     * @return
     */
    List<ApplyData> getSevenDaysApply();

    /**
     * 获取指定科室七日用血申请单数
     * @param code
     * @return
     */
    Integer getSevenDaysApplyNum(String code);

    /**
     * 获取七日用血科室血量统计
     * @return
     */
    List<DepartmentUseNum> getSevenDaysDepartmentUseNum();

    /**
     * 根据输血申请号来更改申请单状态
     * @param transfusionId
     * @param transfusionState
     * @return
     */
    boolean updateTransfusionStateByTransfusionId(String transfusionId, String transfusionState);


    /**
    * @description: 全部申请单汇总和已审核申请单汇总
    * @param params
    * @return void
    * @author lhh
    * @date 2024-06-30
    */

    TransfusionApplicationAnalysisVo TransfusionApplicationAnalysis(Map<String, Object> params);

    /**
    * @description: 全部申请单汇总
    * @param
    * @return java.util.Map<java.lang.String,java.util.Map<java.lang.String,com.heu.blood.transfusion.vo.ABOTypeVo>>
    * @author lhh
    * @date 2024-06-30
    */

    Map<String, Map<String, ABOTypeVo>> getSummary();

    /**
    * @description: 不按照部门统计已审核申请单汇总
    * @param
    * @return java.util.Map<java.lang.String,com.heu.blood.transfusion.vo.ABOTypeVo>
    * @author lhh
    * @date 2024-07-01
    */

    Map<String, ABOTypeVo> getSummarizeApplicationsWithoutDepartment();
}
